home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: April 20, 1998
- // Author: mt
- //
- // Description:
- // This script returns the parent of the current project directory
- //
- // Input Arguments:
- // None
- //
- // Return Value:
- // string - the parent of the current project dir
- //
-
- proc string getParentDir( string $directory )
- //
- // Description:
- // Get the parent directory of the given directory.
- //
- // Input Arguments:
- // $directory
- //
- // Return Value:
- // string - the parent
- //
- {
- string $result = $directory;
- int $i = size( $directory ) - 1;
- while ( $i >= 1 ) {
- string $char = substring( $directory, $i, $i );
- if ( ( $char == "/" ) || ( $char == "\\" ) ) {
- if ( $i > 1 ) {
- $result = substring( $directory, 1, $i - 1 );
- } else {
- $result = "/";
- }
- break;
- }
- $i--;
- }
-
- return $result;
- }
-
- global proc string currentProjectParentDir()
- //
- // Description:
- // Global callback for getting the parent of the
- // current project's directory
- //
- // Return Value:
- // string - the parent of the current project dir
- //
- {
- string $projDir = `workspace -q -fn`;
- return getParentDir( $projDir );
- }
-